<?php

/**
 * SysCust form base class.
 *
 * @method SysCust getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseSysCustForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'acct_set_id'  => new sfWidgetFormInputText(),
      'cust_no'      => new sfWidgetFormInputText(),
      'cust_name'    => new sfWidgetFormInputText(),
      'cust_fname'   => new sfWidgetFormTextarea(),
      'cust_type'    => new sfWidgetFormInputText(),
      'cust_addr'    => new sfWidgetFormTextarea(),
      'cust_addr1'   => new sfWidgetFormTextarea(),
      'cust_zip'     => new sfWidgetFormInputText(),
      'cust_tel'     => new sfWidgetFormInputText(),
      'cust_contact' => new sfWidgetFormInputText(),
      'cust_fax'     => new sfWidgetFormInputText(),
      'cust_memo'    => new sfWidgetFormTextarea(),
      'cust_opr'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CustOpr'), 'add_empty' => true)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'acct_set_id'  => new sfValidatorInteger(),
      'cust_no'      => new sfValidatorString(array('max_length' => 45)),
      'cust_name'    => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'cust_fname'   => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'cust_type'    => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cust_addr'    => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'cust_addr1'   => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'cust_zip'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cust_tel'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cust_contact' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cust_fax'     => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'cust_memo'    => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'cust_opr'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CustOpr'), 'required' => false)),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('sys_cust[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'SysCust';
  }

}
